<style>
.division {
	padding-left: 20px;
}

.division li {
	list-style-type: disc;
}

.tableSettingBorder th,.tableSettingBorder td,.tableSettingBorderThL th,.tableSettingBorderThL td
	{
	border-color: #DEDEDE;
	border-style: solid;
	border-width: 1px;
	font-family: 微軟正黑體;
	font-size: 15px;
	padding: 3px;
}

.tableSettingBorder th,.tableSettingBorderThL th,.tableSettingBorderNormalFont th
	{
	background-color: #F1F1F1;
}

.tableSettingBorder td input {
	width: 90%;
	background-color: #F1F1F1;
}

.tableSettingBorder td input:hover,.tableSettingBorder td input:active {
	width: 90%;
	background-color: white;
}

.ContentCenter {
	float: left;
	font-size: 12px;
	line-height: 24px;
	padding: 25px 30px 25px 40px;
}
</style>

<div class="tableform">

    <form
        id="warranty_add_form"
        action="index.php?app=yswarranty&ctl=admin_mywarranty&act=addvalidwarranty"
        method="post"
        class="tableform"
    >
        <table class="tableSettingBorder">
            <tr>
                <th>機種</th>
                <td><{html_options name='product_style' options=$product_styles  values=$product_styles}></td>
            </tr>
            <tr>
                <th>機號</th>
                <td><{input type="text" name="product_no" }></td>
            </tr>
            <tr>
                <th><span style="color: #FF0000">*</span>保證書編號</th>
                <td><{input type="text" name="warranty_no" vtype="require" }></td>
            </tr>
            <tr>
                <th>保證書編碼</th>
                <td><{input type="text" name="verify_code" }></td>
            </tr>
            <tr>
                <th colspan="2"><{assign var="___db" value="关 闭"}> 
                <{assign var="___dc" value=$___b2c='确定退出?'|t:'b2c'}>
                    <{button label=$___b2c="保存当前"|t:'b2c' class="btn-primary" onclick="subDtypeForm(event,1);"}>
                    <{button label=$___b2c="保存并关闭窗口"|t:'b2c' class="btn-primary" onclick="subDtypeForm(event,2);"}>
                    <{button label=$___b2c=$___db|t:'b2c' class="btn-secondary" onclick="if(confirm('{$___dc}')) docloseDialog(); "}>
                 </th>
            </tr>
        </table>
    </form>
</div>

<script>
var _warranty_add_form=$('warranty_add_form');
var _finder = finderGroup['<{$env.get.finder_id}>'];
var _instancedlg=$('warranty_add_form').getParent('.dialog').retrieve('instance');



$('warranty_add_form').store('target', {
		onComplete : function() {
			if (opener.finderGroup['<{$env.get._finder.finder_id}>'])
				opener.finderGroup['<{$env.get._finder.finder_id}>'].refresh();
			window.close();
		}
});
	
function docloseDialog()
{
	_instancedlg.close();
}

subDtypeForm = function (event,sign){ 
	   var target={};
	   switch (sign){
			case 1:                    //保存不关闭
				$extend(target,{
					onComplete:function(e){
						
						if(JSON.decode(e).toclear==false){
							//alert(JSON.decode(e).toclear);
							
						}
						_finder.refresh();						
						event.target.disabled = false;
					}}
				);
			break;
			case 2:                   //保存关闭
				$extend(target,{
					onComplete:function(){
						_finder.refresh();
						_instancedlg.close();				
					}}
				);
			break;				
	   }
	    
		if(!_warranty_add_form)
			   return;
		var _formActionURL=_warranty_add_form.get('action'); 
		
		_warranty_add_form.store('target',target);
		_warranty_add_form.set('action',_formActionURL+'&but='+sign).fireEvent('submit',new Event(event));
    };

	
	
</script>
